package com.example.lib_base.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.lib_base.entity.LoginEntity

@Dao
interface UserDao {
    //新增
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(loginEntity: LoginEntity)

    //查询  一般情况下只有一个
    @Query("select * from user where phone = :phone")
    fun query(phone:String):LoginEntity

    //删除一个用户信息
    @Delete
    fun delete(loginEntity: LoginEntity)

    //删除所有用户信息
    @Query("delete from user")
    fun deleteAll()
}